package com.cloud.system.api.provider;

import com.cloud.system.api.bean.HumanInfoCriteriaBean;
import org.apache.ibatis.jdbc.SQL;

public class HumanInfoPageProvider {

    public String listHumanInfoPage(HumanInfoCriteriaBean bean) {
         String LIST_PAGE_SELECT = " t1.human_id, t1.unit_id, t1.unit_name, t1.user_name, t1.human_password ",
                LIST_PAGE_FOMR = " human_info t1, (select unit_id from unit_info where (unit_id = " + bean.getUnitId() + " or senior_id = " + bean.getUnitId() + ") and delete_flag != 1) t2 ";

        SQL sql = new SQL().SELECT(LIST_PAGE_SELECT).FROM(LIST_PAGE_FOMR);

        sql.WHERE(" t1.unit_id = t2.unit_id AND t1.human_id != - 1 AND t1.human_type = '00' AND t1.delete_flag != 1 ");

        sql.ORDER_BY(" unit_id, human_id");

        return sql.toString();
    }
}
